// NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py
// REQUIRES: powerpc-registered-target
// RUN: %clang_cc1 -triple powerpc64-unknown-linux-gnu \
// RUN:   -emit-llvm %s -o - -target-cpu pwr7 | FileCheck %s
// RUN: %clang_cc1 -triple powerpc64le-unknown-linux-gnu \
// RUN:   -emit-llvm %s -o - -target-cpu pwr8 | FileCheck %s

// The argument expression must not be emitted multiple times

// CHECK-LABEL: @test_fric(
// CHECK-NEXT:  entry:
// CHECK-NEXT:    [[D:%.*]] = alloca double, align 8
// CHECK-NEXT:    [[TMP:%.*]] = alloca double, align 8
// CHECK-NEXT:    [[TMP0:%.*]] = load double, ptr [[D]], align 8
// CHECK-NEXT:    store double [[TMP0]], ptr [[TMP]], align 8
// CHECK-NEXT:    [[TMP1:%.*]] = load double, ptr [[TMP]], align 8
// CHECK-NEXT:    [[TMP2:%.*]] = call double @llvm.rint.f64(double [[TMP1]])
// CHECK-NEXT:    ret void
//
void test_fric() {
  __fric(({double d; d;}));
}
